# bcmdhd
#####################
# SDIO Basic feature
#####################

DHDCFLAGS += -Wall -Wstrict-prototypes -Dlinux -DLINUX -DBCMDRIVER             \
        -DBCMDONGLEHOST -DUNRELEASEDCHIP -DBCMDMA32 -DBCMFILEIMAGE            \
        -DDHDTHREAD -DBDC -DOOB_INTR_ONLY                                     \
        -DDHD_BCMEVENTS -DSHOW_EVENTS -DBCMDBG                                \
        -DMMC_SDIO_ABORT -DBCMSDIO -DBCMLXSDMMC -DWLP2P     \
        -DWIFI_ACT_FRAME -DARP_OFFLOAD_SUPPORT          \
        -DKEEP_ALIVE -DCSCAN -DPKT_FILTER_SUPPORT                             \
        -DEMBEDDED_PLATFORM -DPNO_SUPPORT

#################
# Common feature
#################

DHDCFLAGS += -DCUSTOMER_HW4
DHDCFLAGS += -DWL_CFG80211

# Debug
DHDCFLAGS += -DSIMPLE_MAC_PRINT
DHDCFLAGS += -DDEBUGFS_CFG80211
# Enable wakelock debug function
DHDCFLAGS += -DDHD_TRACE_WAKE_LOCK
# Print out kernel panic point of file and line info when assertion happened
DHDCFLAGS += -DBCMASSERT_LOG
# Collect Current Assoc/Reject Status for Big Data logging
DHDCFLAGS += -DDHD_ENABLE_BIGDATA_LOGGING

# Print 8021X
DHDCFLAGS += -DDHD_8021X_DUMP

# VSDB
DHDCFLAGS += -DVSDB
DHDCFLAGS += -DPROP_TXSTATUS

# Wi-Fi Direct
DHDCFLAGS += -DWL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST
# For p2p connection issue
DHDCFLAGS += -DWL_SCB_TIMEOUT=10
# For TDLS tear down inactive time 10 sec
DHDCFLAGS += -DCUSTOM_TDLS_IDLE_MODE_SETTING=10000
# for TDLS RSSI HIGH for establishing TDLS link
DHDCFLAGS += -DCUSTOM_TDLS_RSSI_THRESHOLD_HIGH=-80
# for TDLS RSSI HIGH for tearing down TDLS link
DHDCFLAGS += -DCUSTOM_TDLS_RSSI_THRESHOLD_LOW=-85

# Roaming
DHDCFLAGS += -DROAM_AP_ENV_DETECTION
DHDCFLAGS += -DROAM_ENABLE -DROAM_CHANNEL_CACHE -DROAM_API
DHDCFLAGS += -DENABLE_FW_ROAM_SUSPEND
DHDCFLAGS += -DDHD_LOSSLESS_ROAMING

# CCX
ifeq ($(CONFIG_BRCM_CCX),y)
  DHDCFLAGS += -DBCMCCX
endif

# SoftAP
DHDCFLAGS += -DWL_SUPPORT_AUTO_CHANNEL -DSUPPORT_HIDDEN_AP
DHDCFLAGS += -DSUPPORT_SOFTAP_SINGL_DISASSOC
DHDCFLAGS += -DDISABLE_11H_SOFTAP

# HW4 specific features
DHDCFLAGS += -DSUPPORT_PM2_ONLY
DHDCFLAGS += -DSUPPORT_DEEP_SLEEP
DHDCFLAGS += -DSUPPORT_AMPDU_MPDU_CMD
DHDCFLAGS += -DPASS_IPV4_SUSPEND
DHDCFLAGS += -DSOFTAP_SEND_HANGEVT
DHDCFLAGS += -DSKIP_WLFC_ON_CONCURRENT
DHDCFLAGS += -DIPV6_NDO_SUPPORT
DHDCFLAGS += -DCUSTOM_EVENT_PM_WAKE=20

# Extended HANG event with reason codes
DHDCFLAGS += -DDHD_USE_EXTENDED_HANG_REASON

# For special PNO Event keep wake lock for 10sec
DHDCFLAGS += -DCUSTOM_PNO_EVENT_LOCK_xTIME=10

# For Passing all multicast packets to host when not in suspend mode.
DHDCFLAGS += -DPASS_ALL_MCAST_PKTS

# Early suspend
DHDCFLAGS += -DDHD_USE_EARLYSUSPEND

# WiFi turn off delay
DHDCFLAGS += -DWIFI_TURNOFF_DELAY=100

# For Scan result patch
DHDCFLAGS += -DESCAN_RESULT_PATCH
DHDCFLAGS += -DDUAL_ESCAN_RESULT_BUFFER
DHDCFLAGS += -DESCAN_BUF_OVERFLOW_MGMT

# For Static Buffer
ifeq ($(CONFIG_BROADCOM_WIFI_RESERVED_MEM),y)
  DHDCFLAGS += -DCONFIG_DHD_USE_STATIC_BUF
  DHDCFLAGS += -DENHANCED_STATIC_BUF
  DHDCFLAGS += -DSTATIC_WL_PRIV_STRUCT
endif

# Ioctl timeout 5000ms
DHDCFLAGS += -DIOCTL_RESP_TIMEOUT=5000

# DPC priority
DHDCFLAGS += -DCUSTOM_DPC_PRIO_SETTING=98

# Priority mismatch fix with kernel stack
DHDCFLAGS += -DPKTPRIO_OVERRIDE

# Prevent rx thread monopolize
DHDCFLAGS += -DWAIT_DEQUEUE

# Config PM Control
DHDCFLAGS += -DCONFIG_CONTROL_PM

# Use Android wake lock mechanism
DHDCFLAGS += -DCONFIG_HAS_WAKELOCK

# idle count
DHDCFLAGS += -DDHD_USE_IDLECOUNT

# Used short dwell time during initial scan
DHDCFLAGS += -DUSE_INITIAL_SHORT_DWELL_TIME

# Japan ccode revision will be fixed by nvram's value
DHDCFLAGS += -DKEEP_JP_REGREV

# SKB TAILPAD to avoid out of boundary memory access
DHDCFLAGS += -DDHDENABLE_TAILPAD

DHDCFLAGS += -DSUPPORT_P2P_GO_PS

# reliable multicast
DHDCFLAGS += -DWL_RELMCAST

# WFA Certification feature
DHDCFLAGS += -DUSE_WFA_CERT_CONF

# Does not forword internal packet
DHDCFLAGS += -DDHD_DONOT_FORWARD_BCMEVENT_AS_NETWORK_PKT



##############################
# Android Platform Definition
##############################

##########
# KitKat
##########
# Definitions are filtered by Kernel version
DHDCFLAGS += -DWL_ENABLE_P2P_IF
DHDCFLAGS += -DWL_SUPPORT_BACKPORTED_KPATCHES
# Default definitions for KitKat
DHDCFLAGS += -DWL_CFG80211_STA_EVENT
DHDCFLAGS += -DWL_IFACE_COMB_NUM_CHANNELS
# To support p2p private command on kernel 3.8 or above
DHDCFLAGS += -DWL_NEWCFG_PRIVCMD_SUPPORT



##########################
# driver type
# m: module type driver
# y: built-in type driver
##########################
DRIVER_TYPE ?= m

#########################
# Chip dependent feature
#########################
ifneq ($(CONFIG_BCM4354),)
  DHDCFLAGS += -DBCM4354_CHIP -DHW_OOB -DSUPPORT_MULTIPLE_REVISION
  DHDCFLAGS += -DMIMO_ANT_SETTING
  DHDCFLAGS += -DUSE_CID_CHECK
  DHDCFLAGS += -DENABLE_BCN_LI_BCN_WAKEUP
  DHDCFLAGS += -DSDIO_CRC_ERROR_FIX

# tput enhancement
  DHDCFLAGS += -DCUSTOM_GLOM_SETTING=8 -DCUSTOM_RXCHAIN=1
  DHDCFLAGS += -DUSE_DYNAMIC_F2_BLKSIZE -DDYNAMIC_F2_BLKSIZE_FOR_NONLEGACY=128
  DHDCFLAGS += -DBCMSDIOH_TXGLOM -DCUSTOM_TXGLOM=1 -DBCMSDIOH_TXGLOM_HIGHSPEED
  DHDCFLAGS += -DDHDTCPACK_SUPPRESS
  DHDCFLAGS += -DUSE_WL_TXBF
  DHDCFLAGS += -DUSE_WL_FRAMEBURST
  DHDCFLAGS += -DRXFRAME_THREAD
  DHDCFLAGS += -DREPEAT_READFRAME
  DHDCFLAGS += -DCUSTOM_AMPDU_BA_WSIZE=64 -DCUSTOM_IBSS_AMPDU_BA_WSIZE=16
  DHDCFLAGS += -DCUSTOM_DPC_CPUCORE=0
  DHDCFLAGS += -DPROP_TXSTATUS_VSDB
  DHDCFLAGS += -DCUSTOM_DEF_TXGLOM_SIZE=40 -DDHD_TXBOUND=40
  DHDCFLAGS += -DENABLE_ADAPTIVE_SCHED -DCUSTOM_CPUFREQ_THRESH=1000000
  DHDCFLAGS += -DCUSTOM_MAX_TXGLOM_SIZE=40
  DHDCFLAGS += -DMAX_HDR_READ=128
  DHDCFLAGS += -DDHD_FIRSTREAD=128
  DHDCFLAGS += -DCUSTOM_AMPDU_MPDU=16

# New Features
  DHDCFLAGS += -DWL11U -DMFP
  DHDCFLAGS += -DBCMCCX
  DHDCFLAGS += -DWES_SUPPORT
  DHDCFLAGS += -DOKC_SUPPORT
  DHDCFLAGS += -DWLTDLS
  DHDCFLAGS += -DWLFBT
  DHDCFLAGS += -DDHD_ENABLE_LPC
  DHDCFLAGS += -DWLAIBSS
  DHDCFLAGS += -DSUPPORT_LTECX
  DHDCFLAGS += -DSUPPORT_2G_VHT
  DHDCFLAGS += -DSUPPORT_WL_TXPOWER
  DHDCFLAGS += -DTEST_TX_POWER_CONTROL
ifeq ($(CONFIG_BCM4354),y)
  DHDCFLAGS += -DENABLE_INSMOD_NO_FW_LOAD
  DHDCFLAGS += -DUSE_LATE_INITCALL_SYNC
  DRIVER_TYPE = y
endif
  DHDCFLAGS += -DCUSTOM_PSPRETEND_THR=30
  DHDCFLAGS += -DDHD_LOG_DUMP

# Enable Roam time thresh
  DHDCFLAGS += -DENABLE_MAX_DTIM_IN_SUSPEND
  DHDCFLAGS += -DCUSTOM_BCN_TIMEOUT_IN_SUSPEND=10
  DHDCFLAGS += -DCUSTOM_ROAM_TIME_THRESH_IN_SUSPEND=6000
  DHDCFLAGS += -DMAX_DTIM_ALLOWED_INTERVAL=925
endif

ifneq ($(CONFIG_BCM4339),)
  DHDCFLAGS += -DBCM4339_CHIP -DHW_OOB
  DHDCFLAGS += -DUSE_CID_CHECK
  DHDCFLAGS += -DENABLE_BCN_LI_BCN_WAKEUP
  DHDCFLAGS += -DUSE_SDIOFIFO_IOVAR

  # tput enhancement
  DHDCFLAGS += -DCUSTOM_GLOM_SETTING=8 -DCUSTOM_RXCHAIN=1
  DHDCFLAGS += -DUSE_DYNAMIC_F2_BLKSIZE -DDYNAMIC_F2_BLKSIZE_FOR_NONLEGACY=128
  DHDCFLAGS += -DBCMSDIOH_TXGLOM -DCUSTOM_TXGLOM=1 -DBCMSDIOH_TXGLOM_HIGHSPEED
  DHDCFLAGS += -DDHDTCPACK_SUPPRESS
  DHDCFLAGS += -DUSE_WL_TXBF
  DHDCFLAGS += -DUSE_WL_FRAMEBURST
  DHDCFLAGS += -DRXFRAME_THREAD
  DHDCFLAGS += -DCUSTOM_AMPDU_BA_WSIZE=64 -DCUSTOM_IBSS_AMPDU_BA_WSIZE=16
  DHDCFLAGS += -DCUSTOM_DPC_CPUCORE=0
  DHDCFLAGS += -DPROP_TXSTATUS_VSDB
ifeq ($(CONFIG_ARCH_MSM),y)
  DHDCFLAGS += -DCUSTOM_DEF_TXGLOM_SIZE=32 -DDHD_TXBOUND=32
  DHDCFLAGS += -DENABLE_ADAPTIVE_SCHED -DCUSTOM_CPUFREQ_THRESH=1000000
endif
  DHDCFLAGS += -DCUSTOM_MAX_TXGLOM_SIZE=32

  # New Features
  DHDCFLAGS += -DWL11U -DMFP
  DHDCFLAGS += -DBCMCCX
  DHDCFLAGS += -DWES_SUPPORT
  DHDCFLAGS += -DOKC_SUPPORT
  DHDCFLAGS += -DWLTDLS -DWLTDLS_AUTO_ENABLE
  DHDCFLAGS += -DWLFBT
  DHDCFLAGS += -DDHD_ENABLE_LPC
  DHDCFLAGS += -DWLAIBSS
  DHDCFLAGS += -DSUPPORT_LTECX
  DHDCFLAGS += -DSUPPORT_2G_VHT
  DHDCFLAGS += -DSUPPORT_WL_TXPOWER
  DHDCFLAGS += -DBCMCCX_S69
ifeq ($(CONFIG_BCM4339),y)
  DHDCFLAGS += -DENABLE_INSMOD_NO_FW_LOAD
  DHDCFLAGS += -DUSE_LATE_INITCALL_SYNC
  DRIVER_TYPE = y
endif
  DHDCFLAGS += -DCUSTOM_PSPRETEND_THR=30
endif

ifneq ($(CONFIG_BCM43455),)
  DHDCFLAGS += -DBCM43455_CHIP -DHW_OOB
  DHDCFLAGS += -DSUPPORT_MULTIPLE_REVISION -DSUPPORT_MULTIPLE_BOARD_REV_FROM_DT
  DHDCFLAGS += -DUSE_CID_CHECK
  DHDCFLAGS += -DENABLE_BCN_LI_BCN_WAKEUP
  DHDCFLAGS += -DUSE_SDIOFIFO_IOVAR

  # tput enhancement
  DHDCFLAGS += -DCUSTOM_GLOM_SETTING=8 -DCUSTOM_RXCHAIN=1
  DHDCFLAGS += -DUSE_DYNAMIC_F2_BLKSIZE -DDYNAMIC_F2_BLKSIZE_FOR_NONLEGACY=128
  DHDCFLAGS += -DBCMSDIOH_TXGLOM -DCUSTOM_TXGLOM=1 -DBCMSDIOH_TXGLOM_HIGHSPEED
  DHDCFLAGS += -DDHDTCPACK_SUPPRESS
  DHDCFLAGS += -DUSE_WL_TXBF
  DHDCFLAGS += -DUSE_WL_FRAMEBURST
  DHDCFLAGS += -DRXFRAME_THREAD
  DHDCFLAGS += -DCUSTOM_AMPDU_BA_WSIZE=64 -DCUSTOM_IBSS_AMPDU_BA_WSIZE=16
  DHDCFLAGS += -DCUSTOM_DPC_CPUCORE=0
  DHDCFLAGS += -DPROP_TXSTATUS_VSDB
  DHDCFLAGS += -DCUSTOM_MAX_TXGLOM_SIZE=32

  # New Features
  DHDCFLAGS += -DWL11U -DMFP
  DHDCFLAGS += -DBCMCCX
  DHDCFLAGS += -DWES_SUPPORT
  DHDCFLAGS += -DOKC_SUPPORT
  DHDCFLAGS += -DWLTDLS -DWLTDLS_AUTO_ENABLE
  DHDCFLAGS += -DWLFBT
  DHDCFLAGS += -DDHD_ENABLE_LPC
  DHDCFLAGS += -DWLAIBSS
  DHDCFLAGS += -DSUPPORT_LTECX
  DHDCFLAGS += -DSUPPORT_2G_VHT
  DHDCFLAGS += -DSUPPORT_WL_TXPOWER
  DHDCFLAGS += -DBCMCCX_S69
ifeq ($(CONFIG_BCM43455),y)
  DHDCFLAGS += -DENABLE_INSMOD_NO_FW_LOAD
  DHDCFLAGS += -DUSE_LATE_INITCALL_SYNC
  DRIVER_TYPE = y
endif
  DHDCFLAGS += -DCUSTOM_PSPRETEND_THR=30
  DHDCFLAGS += -DDHD_LOG_DUMP

  # FCC power limit control on ch12/13.
  DHDCFLAGS += -DFCC_PWR_LIMIT_2G

  # Enable Roam time thresh
  DHDCFLAGS += -DENABLE_MAX_DTIM_IN_SUSPEND
  DHDCFLAGS += -DCUSTOM_BCN_TIMEOUT_IN_SUSPEND=10
  DHDCFLAGS += -DCUSTOM_ROAM_TIME_THRESH_IN_SUSPEND=6000
  DHDCFLAGS += -DMAX_DTIM_ALLOWED_INTERVAL=925
endif

ifneq ($(CONFIG_BCM43454),)
  DHDCFLAGS += -DBCM43454_CHIP -DHW_OOB
  DHDCFLAGS += -DSUPPORT_MULTIPLE_REVISION -DSUPPORT_MULTIPLE_BOARD_REV_FROM_DT
  DHDCFLAGS += -DUSE_CID_CHECK
  DHDCFLAGS += -DENABLE_BCN_LI_BCN_WAKEUP
  DHDCFLAGS += -DUSE_SDIOFIFO_IOVAR

  # tput enhancement
  DHDCFLAGS += -DCUSTOM_GLOM_SETTING=8 -DCUSTOM_RXCHAIN=1
  DHDCFLAGS += -DUSE_DYNAMIC_F2_BLKSIZE -DDYNAMIC_F2_BLKSIZE_FOR_NONLEGACY=128
  DHDCFLAGS += -DBCMSDIOH_TXGLOM -DCUSTOM_TXGLOM=1 -DBCMSDIOH_TXGLOM_HIGHSPEED
  DHDCFLAGS += -DDHDTCPACK_SUPPRESS
  DHDCFLAGS += -DUSE_WL_TXBF
  DHDCFLAGS += -DUSE_WL_FRAMEBURST
  DHDCFLAGS += -DRXFRAME_THREAD
  DHDCFLAGS += -DCUSTOM_AMPDU_BA_WSIZE=64 -DCUSTOM_IBSS_AMPDU_BA_WSIZE=16
  DHDCFLAGS += -DCUSTOM_DPC_CPUCORE=0
  DHDCFLAGS += -DPROP_TXSTATUS_VSDB
  DHDCFLAGS += -DCUSTOM_MAX_TXGLOM_SIZE=32

  # New Features
  DHDCFLAGS += -DWL11U -DMFP
  DHDCFLAGS += -DBCMCCX
  DHDCFLAGS += -DWES_SUPPORT
  DHDCFLAGS += -DOKC_SUPPORT
  DHDCFLAGS += -DWLTDLS -DWLTDLS_AUTO_ENABLE
  DHDCFLAGS += -DWLFBT
  DHDCFLAGS += -DDHD_ENABLE_LPC
  DHDCFLAGS += -DWLAIBSS
  DHDCFLAGS += -DSUPPORT_LTECX
  DHDCFLAGS += -DSUPPORT_2G_VHT
  DHDCFLAGS += -DSUPPORT_WL_TXPOWER
  DHDCFLAGS += -DBCMCCX_S69
ifeq ($(CONFIG_BCM43454),y)
  DHDCFLAGS += -DENABLE_INSMOD_NO_FW_LOAD
  DHDCFLAGS += -DUSE_LATE_INITCALL_SYNC
  DRIVER_TYPE = y
endif
  DHDCFLAGS += -DCUSTOM_PSPRETEND_THR=30
  DHDCFLAGS += -DDHD_LOG_DUMP

  # FCC power limit control on ch12/13.
  DHDCFLAGS += -DFCC_PWR_LIMIT_2G

  # Enable Roam time thresh
  DHDCFLAGS += -DENABLE_MAX_DTIM_IN_SUSPEND
  DHDCFLAGS += -DCUSTOM_BCN_TIMEOUT_IN_SUSPEND=10
  DHDCFLAGS += -DCUSTOM_ROAM_TIME_THRESH_IN_SUSPEND=6000
  DHDCFLAGS += -DMAX_DTIM_ALLOWED_INTERVAL=925
endif

ifneq ($(CONFIG_BCM4335),)
  DHDCFLAGS += -DBCM4335_CHIP -DHW_OOB -DSUPPORT_MULTIPLE_REVISION
  DHDCFLAGS += -DUSE_CID_CHECK
  DHDCFLAGS += -DENABLE_BCN_LI_BCN_WAKEUP
  DHDCFLAGS += -DUSE_SDIOFIFO_IOVAR

  # tput enhancement
  DHDCFLAGS += -DCUSTOM_GLOM_SETTING=8 -DCUSTOM_RXCHAIN=1
  DHDCFLAGS += -DUSE_DYNAMIC_F2_BLKSIZE -DDYNAMIC_F2_BLKSIZE_FOR_NONLEGACY=128
  DHDCFLAGS += -DBCMSDIOH_TXGLOM -DCUSTOM_TXGLOM=1 -DBCMSDIOH_TXGLOM_HIGHSPEED
  DHDCFLAGS += -DDHDTCPACK_SUPPRESS
# DHDCFLAGS += -DDHD_SET_FW_HIGHSPEED
  DHDCFLAGS += -DUSE_WL_TXBF
  DHDCFLAGS += -DUSE_WL_FRAMEBURST
  DHDCFLAGS += -DRXFRAME_THREAD
  DHDCFLAGS += -DREPEAT_READFRAME
  DHDCFLAGS += -DCUSTOM_AMPDU_BA_WSIZE=64
  DHDCFLAGS += -DCUSTOM_DPC_CPUCORE=0
  DHDCFLAGS += -DPROP_TXSTATUS_VSDB
# DHDCFLAGS += -DTPUT_DEBUG
ifeq ($(CONFIG_MACH_JF),y)
  DHDCFLAGS += -DCUSTOM_DEF_TXGLOM_SIZE=32 -DDHD_TXBOUND=32
endif
ifeq ($(CONFIG_ARCH_MSM),y)
  DHDCFLAGS += -DCUSTOM_DEF_TXGLOM_SIZE=32 -DDHD_TXBOUND=32
  DHDCFLAGS += -DENABLE_ADAPTIVE_SCHED -DCUSTOM_CPUFREQ_THRESH=1000000
endif
  DHDCFLAGS += -DCUSTOM_MAX_TXGLOM_SIZE=32

  # New Features
  DHDCFLAGS += -DWL11U -DMFP
  DHDCFLAGS += -DBCMCCX
  DHDCFLAGS += -DWES_SUPPORT
  DHDCFLAGS += -DOKC_SUPPORT
  DHDCFLAGS += -DWLTDLS -DWLTDLS_AUTO_ENABLE
  DHDCFLAGS += -DWLFBT
  DHDCFLAGS += -DDHD_ENABLE_LPC
  DHDCFLAGS += -DWLAIBSS
  DHDCFLAGS += -DSUPPORT_LTECX
  DHDCFLAGS += -DSUPPORT_2G_VHT
  DHDCFLAGS += -DSUPPORT_WL_TXPOWER
# For BT LOCK
ifeq ($(CONFIG_BCM4335BT),y)
  DHDCFLAGS += -DENABLE_4335BT_WAR
endif
ifeq ($(CONFIG_BCM4335),y)
  DHDCFLAGS += -DENABLE_INSMOD_NO_FW_LOAD
  DHDCFLAGS += -DUSE_LATE_INITCALL_SYNC
  DRIVER_TYPE = y
endif
endif

ifneq ($(CONFIG_BCM4334),)
  DHDCFLAGS += -DBCM4334_CHIP -DHW_OOB -DSUPPORT_MULTIPLE_REVISION
  DHDCFLAGS += -DUSE_CID_CHECK
  DHDCFLAGS += -DENABLE_BCN_LI_BCN_WAKEUP
  DHDCFLAGS += -DUSE_DYNAMIC_F2_BLKSIZE -DDYNAMIC_F2_BLKSIZE_FOR_NONLEGACY=64
  DHDCFLAGS += -DCUSTOM_GLOM_SETTING=5
  DHDCFLAGS += -DPROP_TXSTATUS_VSDB
  DHDCFLAGS += -DWES_SUPPORT
  DHDCFLAGS += -DSUPPORT_WL_TXPOWER
ifeq ($(CONFIG_ARCH_MSM8960),y)
  DHDCFLAGS += -DDHD_SDALIGN=4
endif
  # New Features
  DHDCFLAGS += -DWL11U
ifeq ($(CONFIG_BCM4334),y)
  DHDCFLAGS += -DENABLE_INSMOD_NO_FW_LOAD
  DHDCFLAGS += -DUSE_LATE_INITCALL_SYNC
  DRIVER_TYPE = y
endif
endif

ifneq ($(CONFIG_BCM4334W),)
  DHDCFLAGS += -DBCM4334W_CHIP -DHW_OOB -DSUPPORT_MULTIPLE_REVISION
  DHDCFLAGS += -DUSE_CID_CHECK
  DHDCFLAGS += -DENABLE_BCN_LI_BCN_WAKEUP
  DHDCFLAGS += -DUSE_DYNAMIC_F2_BLKSIZE -DDYNAMIC_F2_BLKSIZE_FOR_NONLEGACY=64
  DHDCFLAGS += -DCUSTOM_GLOM_SETTING=5
  DHDCFLAGS += -DPROP_TXSTATUS_VSDB
  DHDCFLAGS += -DWES_SUPPORT
  DHDCFLAGS += -DSUPPORT_WL_TXPOWER
ifeq ($(CONFIG_ARCH_MSM8960),y)
  DHDCFLAGS += -DDHD_SDALIGN=4
endif
  # New Features
  DHDCFLAGS += -DWL11U
ifeq ($(CONFIG_BCM4334W),y)
  DHDCFLAGS += -DENABLE_INSMOD_NO_FW_LOAD
  DHDCFLAGS += -DUSE_LATE_INITCALL_SYNC
  DRIVER_TYPE = y
endif
endif

ifneq ($(CONFIG_BCM4343),)
  DHDCFLAGS += -DBCM43430_CHIP -DSUPPORT_MULTIPLE_REVISION -DHW_OOB
  DHDCFLAGS += -DUSE_CID_CHECK
  DHDCFLAGS += -DCUSTOM_GLOM_SETTING=0
  DHDCFLAGS += -DENABLE_BCN_LI_BCN_WAKEUP

  # tput enhancement
  DHDCFLAGS += -DUSE_DYNAMIC_F2_BLKSIZE -DDYNAMIC_F2_BLKSIZE_FOR_NONLEGACY=128
  DHDCFLAGS += -DRXFRAME_THREAD -DRXTHREAD_ONLYSTA
  DHDCFLAGS += -DMAX_HDR_READ=128
  DHDCFLAGS += -DDHD_FIRSTREAD=128
  DHDCFLAGS += -DCUSTOM_AMPDU_BA_WSIZE=64 -DCUSTOM_IBSS_AMPDU_BA_WSIZE=16

 # New Features
  DHDCFLAGS += -DWL11U
  DHDCFLAGS += -DBCMCCX
  DHDCFLAGS += -DWES_SUPPORT
  DHDCFLAGS += -DOKC_SUPPORT
  DHDCFLAGS += -DWLFBT
  DHDCFLAGS += -DWLTDLS -DWLTDLS_AUTO_ENABLE
  DHDCFLAGS += -DDHD_LOG_DUMP

ifeq ($(CONFIG_BCM4343),y)
  DHDCFLAGS += -DENABLE_INSMOD_NO_FW_LOAD
  DHDCFLAGS += -DUSE_LATE_INITCALL_SYNC
  DRIVER_TYPE = y
endif

  # FCC power limit control on ch12/13.
  DHDCFLAGS += -DFCC_PWR_LIMIT_2G

  # Enable Roam time thresh
  DHDCFLAGS += -DENABLE_MAX_DTIM_IN_SUSPEND
  DHDCFLAGS += -DCUSTOM_BCN_TIMEOUT_IN_SUSPEND=10
  DHDCFLAGS += -DCUSTOM_ROAM_TIME_THRESH_IN_SUSPEND=6000
  DHDCFLAGS += -DMAX_DTIM_ALLOWED_INTERVAL=925

  # Remove common feature for BCM4343
  DHDCFLAGS :=$(filter-out -DDHD_USE_IDLECOUNT,$(DHDCFLAGS))
  DHDCFLAGS :=$(filter-out -DDISABLE_11H_SOFTAP,$(DHDCFLAGS))
  DHDCFLAGS :=$(filter-out -DSUPPORT_P2P_GO_PS,$(DHDCFLAGS))
endif

ifneq ($(CONFIG_BCM4330),)
  DHDCFLAGS += -DBCM4330_CHIP -DSUPPORT_MULTIPLE_REVISION
  DHDCFLAGS += -DMCAST_LIST_ACCUMULATION
  DHDCFLAGS += -DCUSTOM_GLOM_SETTING=0
  DHDCFLAGS += -DWL_CFG80211_GON_COLLISION
ifeq ($(CONFIG_BCM4330),y)
  DHDCFLAGS += -DENABLE_INSMOD_NO_FW_LOAD
  DHDCFLAGS += -DUSE_LATE_INITCALL_SYNC
  DRIVER_TYPE = y
endif
  # Remove common feature for BCM4330
  DHDCFLAGS :=$(filter-out -DSUPPORT_AMPDU_MPDU_CMD,$(DHDCFLAGS))
  DHDCFLAGS :=$(filter-out -DVSDB,$(DHDCFLAGS))
  DHDCFLAGS :=$(filter-out -DPROP_TXSTATUS,$(DHDCFLAGS))
  DHDCFLAGS :=$(filter-out -DROAM_AP_ENV_DETECTION,$(DHDCFLAGS))
  DHDCFLAGS :=$(filter-out -DDHD_USE_IDLECOUNT,$(DHDCFLAGS))
  DHDCFLAGS :=$(filter-out -DDISABLE_11H_SOFTAP,$(DHDCFLAGS))
  DHDCFLAGS :=$(filter-out -DSUPPORT_P2P_GO_PS,$(DHDCFLAGS))
endif

ifneq ($(CONFIG_BCM43241),)
  DHDCFLAGS += -DBCM43241_CHIP -DHW_OOB
  DHDCFLAGS += -DMIMO_ANT_SETTING
  DHDCFLAGS += -DCUSTOM_GLOM_SETTING=1 -DCUSTOM_SDIO_F2_BLKSIZE=128
  DHDCFLAGS += -DUSE_SDIOFIFO_IOVAR
  DHDCFLAGS += -DAMPDU_HOSTREORDER
ifeq ($(CONFIG_BCM43241),m)
  DHDCFLAGS += -fno-pic
endif
ifeq ($(CONFIG_BCM43241),y)
  DHDCFLAGS += -DENABLE_INSMOD_NO_FW_LOAD
  DHDCFLAGS += -DUSE_LATE_INITCALL_SYNC
  DRIVER_TYPE = y
endif
endif


#############################
# Platform dependent feature
#############################

ifeq ($(CONFIG_SPI_SC8810),y)
  DHDCFLAGS += -DREAD_MACADDR -DBCMSPI -DBCMSPI_ANDROID -DSPI_PIO_32BIT_RW -DSPI_PIO_RW_BIGENDIAN
  DHDCFLAGS += -UCUSTOM_DPC_PRIO_SETTING

  #Remove defines for SDMMC
  DHDCFLAGS :=$(filter-out -DOOB_INTR_ONLY,$(DHDCFLAGS))
  DHDCFLAGS :=$(filter-out -DBCMLXSDMMC,$(DHDCFLAGS))

  #Remove defines for JB
  DHDCFLAGS :=$(filter-out -DWL_ENABLE_P2P_IF,$(DHDCFLAGS))
  DHDCFLAGS :=$(filter-out -DMULTIPLE_SUPPLICANT,$(DHDCFLAGS))
  DHDCFLAGS :=$(filter-out -DWL_CFG80211_STA_EVENT,$(DHDCFLAGS))
endif

# For SLP feature
ifeq ($(CONFIG_SLP),y)
  DHDCFLAGS += -DUSE_INITIAL_2G_SCAN
  DHDCFLAGS += -DPLATFORM_SLP -DWRITE_MACADDR
  DHDCFLAGS += -DSUPPORT_MULTIPLE_CHIPS -DENABLE_4335BT_WAR
  DHDCFLAGS += -USUPPORT_MULTIPLE_REVISION -UCONFIG_HAS_WAKELOCK
endif

# GGSM_WIFI_5GHz_CHANNELS feature is define for only GGSM model
ifeq ($(GGSM_WIFI_5GHz_CHANNELS),true)
  DHDCFLAGS += -DCUSTOMER_SET_COUNTRY
endif

ifeq ($(CONFIG_OF),y)
ifneq ($(CONFIG_MACH_UNIVERSAL5430),)
obj-$(CONFIG_MACH_UNIVERSAL5430) += dhd_custom_exynos.o
DHDCFLAGS += -DDHD_OF_SUPPORT
endif
ifneq ($(CONFIG_MACH_UNIVERSAL5422),)
obj-$(CONFIG_MACH_UNIVERSAL5422) += dhd_custom_exynos.o
DHDCFLAGS += -DDHD_OF_SUPPORT
endif
ifneq ($(CONFIG_MACH_UNIVERSAL7580),)
DHDCFLAGS += -DDHD_OF_SUPPORT
endif
ifneq ($(CONFIG_MACH_UNIVERSAL3475),)
DHDCFLAGS += -DDHD_OF_SUPPORT
endif
ifneq ($(CONFIG_ARCH_SWA100),)
DHDCFLAGS += -DDHD_OF_SUPPORT
endif
ifneq ($(CONFIG_MACH_UNIVERSAL5433),)
DHDCFLAGS += -DSDIO_PADDING_FOR_BLK_TRANS
endif
endif

##############################################################
# dhd_sec_feature.h
DHDCFLAGS += -include "dhd_sec_feature.h"
##############################################################

#########
# Others
#########

#EXTRA_LDFLAGS += --strip-debug

EXTRA_CFLAGS += $(DHDCFLAGS) -DDHD_DEBUG
EXTRA_CFLAGS += -DSRCBASE=\"$(src)\"
EXTRA_CFLAGS += -I$(src)/include/ -I$(src)/
KBUILD_CFLAGS += -I$(LINUXDIR)/include -I$(shell pwd)

DHDOFILES := bcmsdh.o bcmsdh_linux.o bcmsdh_sdmmc.o bcmsdh_sdmmc_linux.o \
	dhd_cdc.o dhd_pno.o dhd_common.o dhd_wlfc.o dhd_ip.o dhd_custom_gpio.o dhd_custom_sec.o \
	dhd_linux.o dhd_linux_sched.o dhd_cfg80211.o dhd_sdio.o dhd_linux_wq.o aiutils.o bcmevent.o \
	bcmutils.o bcmwifi_channels.o hndpmu.o linux_osl.o sbutils.o siutils.o \
	wl_android.o wl_cfg80211.o wl_cfgp2p.o wl_cfg_btcoex.o wldev_common.o wl_linux_mon.o wl_roam.o \
	dhd_linux_platdev.o dhd_pno.o dhd_linux_wq.o wl_cfg_btcoex.o

# For SPI projects
ifeq ($(CONFIG_SPI_SC8810),y)
DHDOFILES += bcmsdspi_linux.o bcmspibrcm.o
DHDOFILES :=$(filter-out bcmsdh_sdmmc.o,$(DHDOFILES))
DHDOFILES :=$(filter-out bcmsdh_sdmmc_linux.o,$(DHDOFILES))
endif

dhd-y := $(DHDOFILES)
obj-$(DRIVER_TYPE)   += dhd.o

all:
	@echo "$(MAKE) --no-print-directory -C $(KDIR) SUBDIRS=$(CURDIR) modules"
	@$(MAKE) --no-print-directory -C $(KDIR) SUBDIRS=$(CURDIR) modules

clean:
	rm -rf *.o *.ko *.mod.c *~ .*.cmd *.o.cmd .*.o.cmd \
	Module.symvers modules.order .tmp_versions modules.builtin

install:
	@$(MAKE) --no-print-directory -C $(KDIR) \
		SUBDIRS=$(CURDIR) modules_install
